class Solution {
public:
    bool isSubsequence(string s, string t) {
        if(s == "") return true;
        if(s != "" && t == "") return false;
        vector<vector<bool> > dp(s.size(),vector<bool>(t.size(),false));
        if(s[0] == t[0]){
            dp[0][0] = true;
        }
        for(int j = 1;j < t.size();j++){
            if(s[0] == t[j]){
                dp[0][j] = true;
            }else{
                dp[0][j] = dp[0][j - 1];
            }
        }
        for(int i = 1;i < s.size();i++){
            for(int j = 1;j < t.size();j++){
                if(s[i] == t[j]){
                    dp[i][j] = dp[i - 1][j - 1];
                }else{
                    dp[i][j] = dp[i][j - 1];
                }
            }
        }
        
        
        return dp[s.size() - 1][t.size() - 1];
    }
};
